<?php
session_start();
$welcome=$_SESSION['user'];

echo "<p>Edit and Query your Assessment Calender</p>";

//set the values neccessary to connect to the database
$host="localhost";
$username="root";
$password="";
$db="assessmentdb";

//create the connection to the database
$connection=mysql_connect($host, $username, $password);


//select my database
$mysel=mysql_select_db($db);

$query="select * from assessment where username='$welcome'";
$answer=mysql_query($query, $connection);

echo "<table border='2' align='center'>";
echo "<tr>";
echo "<th>";
echo "Username";
echo "</th>";
echo "<th>";
echo "Assessment";
echo "</th>";
echo "<th>";
echo "Due Date";
echo "</th>";
echo "<th>";
echo "Date Completed";
echo "</th>";
echo "<th>";
echo "Description";
echo "</th>";
echo "<th>";
echo "Status";
echo "</th>";
echo "<th>";
echo "Select Status";
echo "</th>";
echo "</tr>";

while($row=mysql_fetch_array($answer))
{
echo "<tr>";
echo "<td>";
echo $field2= $row['username'];
echo "</td>";
echo "<td>";
echo $field3=$row['assessment'];
echo "</td>";
echo "<td>";
echo $field4=$row['duedate'];
echo "</td>";
echo "<td>";
echo $field5=$row['datecompleted'];
echo "</td>";
echo "<td>";
echo $field6=$row['description'];
echo "</td>";
echo "<td>";
echo $field6=$row['status'];
echo "</td>";
echo "<td>";
echo "<input type='checkbox' value='check' id='checkvalue'>";
echo "</td>";
echo "</tr>";

}

echo "</table>";

?>
<html>

<head>
<title> Control Panel</title>
</head>
<body bgcolor="lightblue">


<h1> Query Assessment</h1>

<form action="querydate.php" method ="POST">
Enter Date :
<input type="date" name="date" placeholder="yyyy-mm-dd"/><br> Before <input type="radio" name="radiob" value="before"/>  After <input type="radio" name="radiob" value="after"/>
<input type="submit" name="submitdate" value="Search" />
<hr>

</form>

<form action="querystatus.php" method ="POST">
Enter Status:
<input type="text" name="status" placeholder="completed/ not completed"/>
<input type="submit" name="submitstatus" value="Search" />

</form>



</body>
</html>